#include "spriteFactory.h"


void SpriteFactory::addSprite(Sprite *sprite){
	sprites.push_back(sprite);
}

void SpriteFactory::addSprite(const Vector2f& pos, const Vector2f& vel,
                 const string &filename,FrameFactory *ff){
				 //cout<<filename.substr(filename.size()-3)<<endl;
				 size_t dot = filename.find(".");
				 string postfix = filename.substr(dot+1);
				 //create Sprite
				 if(filename.substr(filename.size()-3)=="bmp"){
					sprites.push_back(new Sprite(pos, vel,
					ff->getFrame(filename,gameData->getXmlInt("ballWidth"), 
					gameData->getXmlInt("ballHeight"), 0, 0, true)));
				 }
				 //create L-System
				 if(filename.substr(filename.size()-3)=="xml"){
					sprites.push_back(new LSystem(pos, vel, filename,ff));
				 }
}

std::vector<Sprite *>SpriteFactory::getSprites() const{
	return sprites;
}
